package com.frank.wechat.handler;

import lombok.Getter;

/**
 * @author Frank Zou
 * @version v0.0.1
 * @date 2024/2/21
 * @description
 */
@Getter
public enum WeChatMessageTypeEnum {
    SUBSCRIPTION("event.subscribe","订阅消息"),
    TEXT("text","文本消息");

    private final String type;

    private final String desc;

    WeChatMessageTypeEnum(String type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public static WeChatMessageTypeEnum getMessageTypeByType(String type) {
        for (WeChatMessageTypeEnum weChatMessageTypeEnum : WeChatMessageTypeEnum.values()) {
            if (weChatMessageTypeEnum.getType().equals(type)) {
                return weChatMessageTypeEnum;
            }
        }
        return null;
    }
}
